Skip to content

Add browser MP3 cleanse integration & rollout plan#6

Closed
ChrisAdamsdevelopment wants to merge 1 commit into
codex/improve-ui-designfrom
codex/integrate-in-browser-mp3-cleansing-feature
Closed

Add browser MP3 cleanse integration & rollout plan#6
ChrisAdamsdevelopment wants to merge 1 commit into
codex/improve-ui-designfrom
codex/integrate-in-browser-mp3-cleansing-feature

Conversation

@ChrisAdamsdevelopment
Copy link
Copy Markdown
Owner

@ChrisAdamsdevelopment ChrisAdamsdevelopment commented May 4, 2026

Closed as superseded planning work. The implementation path landed through PR #8 for stabilization and PR #9 for browser MP3 quick cleanse integration.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 4, 2026

Reviewer's Guide

Adds a single documentation file describing a phased plan and architecture for integrating a browser-based MP3 metadata cleanse flow into the existing SpectraCleanse client, including UX guidance, KPIs, QA checklist, risks, and rollout strategy, with no code changes to the app itself.

Sequence diagram for the new browser MP3 cleanse and server fallback flow

sequenceDiagram
    actor User
    participant BrowserClient
    participant MetadataUtils
    participant SEOApi as Backend_API_generate_seo
    participant ProcessApi as Backend_API_process

    User->>BrowserClient: UploadFile(file)
    BrowserClient->>MetadataUtils: readFileMetadata(file)
    MetadataUtils-->>BrowserClient: metadata, provenanceIndicators
    BrowserClient->>BrowserClient: UpdateContextTab(metadata)

    User->>BrowserClient: ClickGenerateAISEOPayload()
    BrowserClient->>SEOApi: POST /api/generate-seo (fileId, authToken)
    SEOApi-->>BrowserClient: seoPayload
    BrowserClient->>BrowserClient: UpdateSEOPayloadTab(seoPayload)

    User->>BrowserClient: ChooseQuickCleanseBrowser()
    alt FileIsMP3AndFeatureFlagEnabled
        BrowserClient->>MetadataUtils: writeMP3Metadata(file, seoPayload)
        MetadataUtils-->>BrowserClient: cleansedFile
        BrowserClient->>BrowserClient: UpdateAnalysisTab(provenanceRisk)
        User->>BrowserClient: ClickDownloadProcessedFile()
        BrowserClient-->>User: Download(cleansedFile)
    else NonMP3OrFlagDisabled
        User->>BrowserClient: ChooseFullServerCleanse()
        BrowserClient->>ProcessApi: POST /api/process (file, seoPayload, authToken)
        ProcessApi-->>BrowserClient: processedFile, forensicReport, usageHeaders
        BrowserClient->>BrowserClient: UpdateAnalysisTab(forensicReport)
        BrowserClient->>BrowserClient: UpdateUsageFromHeaders(usageHeaders)
        User->>BrowserClient: ClickDownloadProcessedFile()
        BrowserClient-->>User: Download(processedFile)
    end
Loading

Class diagram for planned client-side cleanse flow and utilities

classDiagram
    class BrowserClientApp {
        +bool featureEnableBrowserMP3Cleanse
        +File currentFile
        +SEOData currentSEOPayload
        +AnalysisData currentAnalysis
        +void onFileUpload(file)
        +void generateSEO()
        +void handleCleanse(useBrowser)
        +void updateContextTab(metadata)
        +void updateSEOTab(seoPayload)
        +void updateAnalysisTab(analysis)
        +void downloadProcessedFile()
    }

    class MetadataUtils {
        +Metadata readFileMetadata(file)
        +File writeMP3Metadata(file, metadata)
        +ProvenanceRisk assessProvenanceRisk(metadata, filename)
    }

    class FeatureFlagConfig {
        +bool enableBrowserMP3Cleanse
        +bool isBrowserCleanseEnabledForFile(file)
    }

    class SEOApiClient {
        +SEOData generateSEO(fileId, authToken)
    }

    class ProcessApiClient {
        +ProcessResult processMedia(file, seoPayload, authToken)
    }

    class UsageTracker {
        +int remainingCredits
        +void updateFromHeaders(headers)
    }

    class TabsController {
        +void showContextTab()
        +void showSEOPayloadTab()
        +void showAnalysisTab()
        +void persistSessionLogs(logEntries)
    }

    class DownloadManager {
        +string currentObjectUrl
        +void createDownloadUrl(file)
        +void revokeObjectUrl()
    }

    BrowserClientApp --> MetadataUtils : uses
    BrowserClientApp --> FeatureFlagConfig : reads
    BrowserClientApp --> SEOApiClient : calls
    BrowserClientApp --> ProcessApiClient : calls
    BrowserClientApp --> UsageTracker : updates
    BrowserClientApp --> TabsController : controls
    BrowserClientApp --> DownloadManager : manages

    MetadataUtils ..> DownloadManager : sharesFileReferences

    class Metadata {
        +string title
        +string artist
        +string album
        +map tags
    }

    class SEOData {
        +string title
        +string description
        +string keywords
    }

    class AnalysisData {
        +Metadata metadata
        +ProvenanceRisk provenanceRisk
        +string recommendedAction
    }

    class ProcessResult {
        +File processedFile
        +AnalysisData analysis
        +Headers responseHeaders
    }

    class ProvenanceRisk {
        +string level
        +string[] indicators
    }
Loading

File-Level Changes

Change Details Files
Add a detailed integration and rollout plan document for browser-based MP3 cleanse into SpectraCleanse, covering architecture, phased implementation, UX, KPIs, QA, risks, and rollout.
  • Document objectives and constraints for integrating the browser MP3 cleanser alongside existing auth, billing, limits, and server pipeline.
  • Describe architecture decisions, data flow, and interaction between browser cleanse and existing /api/generate-seo and /api/process endpoints.
  • Outline a phased implementation plan from preflight alignment through dependencies, flow integration, UX polish, hardening, and release.
  • Provide UX recommendations for the tabbed interface, CTAs, trust messaging, and download ergonomics.
  • Define KPIs, QA checklist, identified risks with mitigations, suggested ticket breakdown, and staged rollout strategy including feature flagging.
docs/mp3-browser-integration-plan.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In the implementation plan, where you recommend browser cleanses not counting toward monthly usage, it would help to explicitly capture the alternate path (if product later decides they should count) so engineers know exactly where to plug in usage updates on the client and server paths.
  • Consider adding concrete request/response examples or field contracts for /api/generate-seo and /api/process (e.g., required headers, expected SEO payload shape, error payload schema) so the future client wiring work has less ambiguity and better alignment with backend expectations.
  • Since the plan introduces new browser metadata dependencies and local ID3 writing, it might be useful to briefly call out any security/privacy constraints (e.g., no remote calls from those libs, supported file size limits, handling of corrupted files) to guide library selection and hardening work in Phase 4.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the implementation plan, where you recommend browser cleanses not counting toward monthly usage, it would help to explicitly capture the alternate path (if product later decides they should count) so engineers know exactly where to plug in usage updates on the client and server paths.
- Consider adding concrete request/response examples or field contracts for `/api/generate-seo` and `/api/process` (e.g., required headers, expected SEO payload shape, error payload schema) so the future client wiring work has less ambiguity and better alignment with backend expectations.
- Since the plan introduces new browser metadata dependencies and local ID3 writing, it might be useful to briefly call out any security/privacy constraints (e.g., no remote calls from those libs, supported file size limits, handling of corrupted files) to guide library selection and hardening work in Phase 4.

## Individual Comments

### Comment 1
<location path="docs/mp3-browser-integration-plan.md" line_range="30" />
<code_context>
+
+### Keep
+- New browser cleanse state machine and decoupled download flow.
+- Dark themed tabbed UI (`Context`, `SEO Payload`, `Analysis`).
+- Memory-safe object URL lifecycle.
+
</code_context>
<issue_to_address>
**nitpick (typo):** Consider hyphenating "Dark-themed" as a compound adjective.

Because it precedes “UI,” the hyphenated form is the standard and clearer spelling.

Suggested implementation:

```
- Dark-themed tabbed UI (`Context`, `SEO Payload`, `Analysis`).

```

If this phrasing appears elsewhere in the document (e.g., headings or other bullets), you may also want to standardize them to "Dark-themed" for consistency.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.


### Keep
- New browser cleanse state machine and decoupled download flow.
- Dark themed tabbed UI (`Context`, `SEO Payload`, `Analysis`).
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick (typo): Consider hyphenating "Dark-themed" as a compound adjective.

Because it precedes “UI,” the hyphenated form is the standard and clearer spelling.

Suggested implementation:

- Dark-themed tabbed UI (`Context`, `SEO Payload`, `Analysis`).

If this phrasing appears elsewhere in the document (e.g., headings or other bullets), you may also want to standardize them to "Dark-themed" for consistency.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e791ea8014

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

### User value
1. **Speed:** MP3 users get immediate local cleanse with no upload required.
2. **Trust:** Local/offline-friendly flow reduces privacy concerns.
3. **Control:** Explicit two-step process (`Generate SEO` -> `Cleanse`) and manual download button.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Decouple quick cleanse from mandatory SEO generation

The plan defines an explicit Generate SEO -> Cleanse sequence, which makes local MP3 cleansing depend on /api/generate-seo availability; if that endpoint is down, unauthenticated, or quota-limited, users lose the browser-only path even though local ID3 writing could still succeed. This conflicts with the stated goals of speed/privacy for MP3 users and creates an avoidable single point of failure in the primary flow.

Useful? React with 👍 / 👎.

3. **Analysis tab clarity**
- Split into cards: file info, extracted tags, provenance risk, recommended action.
4. **Trust copy**
- For browser path: “processed locally in your browser; nothing uploaded.”
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid absolute 'nothing uploaded' privacy claim

The proposed trust copy says “nothing uploaded,” but this same plan routes Generate AI SEO Payload through authenticated POST /api/generate-seo, which transmits user-provided prompt content to the backend. Keeping this absolute wording is likely to mislead privacy-sensitive users; the copy should distinguish “audio file stays local” from metadata/text sent for SEO generation.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant